﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EasyDDD.AdminModule.Application.CommandsSysAdmin
{
    public record SysAdminDeleteCommand : ICommand
    {
        public Guid Id { get; set; }
    }

    public class SysAdminDeleteCommandHandler(
        Repository.SysAdminRepository repository,
        ILogger<SysAdminDeleteCommandHandler> logger)
        : ICommandHandler<SysAdminDeleteCommand>
    {
        public async Task Handle(SysAdminDeleteCommand request, CancellationToken cancellationToken)
        {
            logger.LogDebug("命令 SysAdminDeleteCommandHandler");
            var entity = await repository.GetAsync(request.Id);
            entity.Delete();
        }
    }

}
